<header id="topbar" class="affix">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="<%= window.location.href %>">用户详情</a>
            </li>
            <li class="crumb-link">
                <a href="#console/user/">用户管理</a>
            </li>
            <li class="crumb-trail">用户编辑</li>
        </ol>
    </div>
    <div class="pull-right">
        <a href="javascript:;" class="btn btn-primary btn-sm light fw600 ml10" id='userSave'><span class="fa fa-save"></span>保存</a>
    </div>
</header>
<section id="content">
    <div class="panel">
        <form id="user-form" class="form-horizontal" role="form">
            <div class="form-group">
                <label class="col-md-1 control-label">用户ID：</label>
                <div class="col-md-4">
                    <p class="form-control-static text-muted">
                        <%= info.id %>
                    </p>
                </div>
                <label class="col-md-1 control-label">用户邮箱：</label>
                <div class="col-md-4">
                    <p class="form-control-static text-muted">
                        <%= info.email %>
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-1 control-label">用户昵称:</label>
                <div class="col-md-4">
                    <input type="text"  value="<%= info.nickname %>" id="inputNickname" class="form-control">
                </div>
                <label class="col-md-1 control-label">用户角色：</label>
                <div class="col-md-4">
                    <select id="inputRole" class="form-control">
                    <% _.each(USER_ROLE, function(v, k){
                        if(role < k) return; %>
                        <option value="<%= k %>" <%= info.role == k ? "selected" : "" %>> <%= v %> </option>
                    <% }) %>
                    </select>
                </div>
            </div>
            <% if(role > info.role) { %>
            <div class="form-group">
                <label class="col-md-1 control-label">用户权限：</label>
                <div class="col-md-4">
                    <%
                        var editor_perm = perm ? perm.split('|') : []; 
                        var user_perm = info.perm ? info.perm.split('|') : []; 
                    %>
                    <select id="inputPerm" class="form-control select" multiple>
                    <% _.each(PERMISSION_ROLE, function(v, k){
                        if (role == 5 || editor_perm.indexOf(k) != -1) {
                     %>
                        <option value="<%= k %>" <%= user_perm.indexOf(k) != -1 ? "selected" : "" %>> <%= v %> </option>
                    <% }}) %>
                    </select>
                </div>
            </div>
            <% } %>
        </form>
    </div>

</section>
